(function (G) {
    G.vue({
        data: {
            models: {
                name: {
                    rule: {
                        NotNull: true
                    },
                    label: '物资名称',
                    type: 'input'
                },
                images: {
                    attr:{
                        limit:9
                    },
                    label: '图片',
                    type: 'image'
                },
                description: {
                    label: '用途',
                    attr: {
                        placeholder: '描述用途,不超过300字',
                        maxlength: 300
                    },
                    type: 'textarea'
                },
                // userName:{
                //     label:'申请人',
                //     type:'input'
                // },
                // enterpriceName:{
                //     label:'所属单位',
                //     type:'input'
                // }
            }
        },
        methods: {
            save() {
                var data = this.selectComponent('#form').submit()
                if (!data) return false
                let userInfo = G.Storage.get('userInfo')
                data.userName = userInfo.name
                data.unitName = userInfo.unitName
                data.enterpriceName = userInfo.enterpriceName
                G.post('/v1/task/add', {
                    userId: userInfo.userId,
                    flowId: '1645685394316070912',
                    data,
                    des: userInfo.enterpriceName,
                    // expand1:this.data.address,
                    // toUsers:toUsers,
                    title: `[${userInfo.name}]物资申领-${data.name}`
                }).then(res => {
                    if (!res.errorMsg) {
                        G.toask('申请流程发起成功')
                        setTimeout(() => {
                            this.$back()
                        }, 2000)
                    }
                })
            }
        },
        mounted(options) {
            
        }
    })
})(wx.$)